package com.unity3d.player;

import android.os.*;

final class j implements UncaughtExceptionHandler
{
    private volatile UncaughtExceptionHandler a;

    final boolean a() {
        // monitorenter(this)
        try {
            final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
            boolean b;
            if (defaultUncaughtExceptionHandler == this) {
                b = false;
            }
            else {
                this.a = defaultUncaughtExceptionHandler;
                Thread.setDefaultUncaughtExceptionHandler((Thread.UncaughtExceptionHandler)this);
                b = true;
            }
            // monitorexit(this)
            return b;
        }
        finally {
            // monitorexit(this)
            while (true) {}
        }
    }

    @Override
    public final void uncaughtException(final Thread thread, final Throwable t) {
        // monitorenter(this)
        while (true) {
            try {
                // monitorexit(this)
                Label_0154: {
                    try {
                        final StringBuilder sb = new StringBuilder();
                        sb.append(String.format("FATAL EXCEPTION [%s]\n", thread.getName()));
                        sb.append(String.format("Unity version     : %s\n", "5.6.1f1"));
                        sb.append(String.format("Device model      : %s %s\n", Build.MANUFACTURER, Build.MODEL));
                        sb.append(String.format("Device fingerprint: %s\n", Build.FINGERPRINT));
                        final Error error = new Error(sb.toString());
                        error.setStackTrace(new StackTraceElement[0]);
                        error.initCause(t);
                        this.a.uncaughtException(thread, error);
                        // monitorexit(this)
                        return;
                    }
                    finally {
                        break Label_0154;
                    }
                    this.a.uncaughtException(thread, t);
                    return;
                }
                // monitorexit(this)
                throw thread;
            }
            catch (Throwable t2) {}
            continue;
        }
    }
}
